#include "util.h"

// -----------------------------------------------------------------------------------------
// Local functions

UINT32 OneAction( ACTIONS_T * list, EVENT_CODE_T event, RESOURCE_ID res, UINT8 op );

// -----------------------------------------------------------------------------------------

UINT32 OneAction( ACTIONS_T * list, EVENT_CODE_T event, RESOURCE_ID res, UINT8 op )
{
	if ( list == NULL || list->count >= 16 )
		return RESULT_FAIL;
	list->action[list->count].operation = op;
	list->action[list->count].event = event;
	list->action[list->count].action_res = res;
	list->count++;
	return RESULT_OK;
}

UINT32 ActionAdd( ACTIONS_T * list, EVENT_CODE_T event, RESOURCE_ID res )
{
	return OneAction(list, event, res, ACTION_OP_ADD);
}

UINT32 ActionDel( ACTIONS_T * list, EVENT_CODE_T event, RESOURCE_ID res )
{
	return OneAction(list, event, res, ACTION_OP_DELETE);
}

UINT32 ActionUpd( ACTIONS_T * list, EVENT_CODE_T event, RESOURCE_ID res )
{
	return OneAction(list, event, res, ACTION_OP_UPDATE);
}

